package com.ljb.haikanglibrary.utils;

import android.content.Context;
import android.widget.Toast;


/**
 * 单例的Toast
 * Created by lijianbin on 2016/10/12.
 */
public class T {

    private static Toast t;

    private T() {
    }

    /**
     * 显示相应的文本内容
     *
     * @param c    上下文
     * @param text 需要显示的文本
     */
    public static void showToast(Context c, String text) {
        if (t == null) {
            t = Toast.makeText(c, text, Toast.LENGTH_SHORT);
//            t.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0);
//            View view = t.getView();
//            TextView message = (TextView) view.findViewById(android.R.id.message);
//            message.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
        } else {
            t.setText(text);
        }
        t.show();
    }

}
